package com.tiandang.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tiandang.core.service.RefundNotifyService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/wechat/refund")
public class RefundController {

  private final Logger log = LoggerFactory.getLogger(this.getClass());

  @Autowired
  private RefundNotifyService refundNotifyService;

  /**
   * 微信异步通知
   */
  @PostMapping("/notify")
  public void notify(HttpServletRequest request, HttpServletResponse response) {
    refundNotifyService.parseRefundNotifyAndResponse(request, response);
  }
}
